package MapDemo;


import java.util.Iterator;
import java.util.Set;
import java.util.TreeMap;

public class TreeMapDemo1 {
    public static void main(String[] args) {
        TreeMap<String, String> map = new TreeMap<String,String>();
        map.put("001", "香港");
        map.put("002", "台湾");
        map.put("003", "北京");
        map.put("004", "广州");
        System.out.println(map);
        Set<String> keys = map.keySet();
        //迭代Set
        for (Iterator<String> it = keys.iterator(); it.hasNext();) {
            String key =it.next();
            //获得value
            String value = map.get(key);
            System.out.println(key+"==="+value);
        }
    }
}
